package front.end.subestacao.ui;

import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.ByteArrayInputStream;
import java.io.IOException;

import javax.swing.tree.DefaultMutableTreeNode;

import front.end.subestacao.itens.Componente;

public class TransferableTreeNode extends DefaultMutableTreeNode implements
		Transferable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	final public static DataFlavor DEFAULT_MUTABLE_TREENODE_FLAVOR = new DataFlavor(
			DefaultMutableTreeNode.class, "Default Mutable Tree Node");

	static DataFlavor flavors[] = { DEFAULT_MUTABLE_TREENODE_FLAVOR };

	

	public TransferableTreeNode(String nome) {
		super(nome);
	}

	public TransferableTreeNode(Object userObject) {
		super(userObject);
		
	}

	public DataFlavor[] getTransferDataFlavors() {
		return flavors;
	}

	public Object getTransferData(DataFlavor flavor)
			throws UnsupportedFlavorException, IOException {

		return this.getUserObject();
	}

	public boolean isDataFlavorSupported(DataFlavor flavor) {
		
		boolean returnValue = true;

		if (flavor.equals(flavors[0])) {
			returnValue = true;

		}

		return returnValue;
	}
}
